********************************************************************************
********************* Replication DoFile  **************************************
*******************Supression by Mobilization***********************************
******************* Political Research Quarterly *******************************
****************** Shao, Li & Liu, Dongshu & Wang, Fangfei**********************
************************ March07, 2024 *****************************************
************************** STATA 17 ********************************************



global yourlink /*use your own link*/  

cd "$yourlink"

use "data_for_replicate_PRQ_Supression_20240307.dta", clear


log using "codebook_Supression.txt", replace t

codebook*

log close


log using "log_Supression.txt", replace t

global control male age edu income party work news_interest foreign_media

*** Balance Table*****
**wave1 Table C.1
preserve
drop if wave==2
eststo Control: estpost summarize  $control if e_group==1
eststo Censor: estpost summarize  $control if e_group==2

eststo Info: estpost summarize $control if e_group==3

eststo Ideo: estpost summarize  $control if e_group==4
eststo Both: estpost summarize $control if e_group==5


esttab   using summary_prop_w1.csv, ///
		label replace cell("mean(fmt(2)) sd(fmt(2))")  b(2) ///
		mgroups("Control" "Censor" "Info" "Ideo" "Both" , pattern(1 1 1 1 1))
		
eststo clear

file open TABLE using "balance_table_w1.csv", write replace

foreach val of varlist $control {

		oneway `val' e_group 
		local fstat r(F)
		local fprob 1-F(r(df_m), r(df_r),r(F))
		
file write TABLE "," (`fstat') "," (`fprob')  _n     
}
file close TABLE
restore
**wave2 Table C.2
preserve
drop if wave==1
eststo Control: estpost summarize  $control if e_group==1
eststo Censor: estpost summarize  $control if e_group==2

eststo Info: estpost summarize $control if e_group==3

eststo Ideo: estpost summarize  $control if e_group==4
eststo Both: estpost summarize $control if e_group==5


esttab   using summary_prop_w2.csv, ///
		label replace cell("mean(fmt(2)) sd(fmt(2))")  b(2) ///
		mgroups("Control" "Censor" "Info" "Ideo" "Both" , pattern(1 1 1 1 1))
		
eststo clear

file open TABLE using "balance_table_w2.csv", write replace

foreach val of varlist $control {

		oneway `val' e_group 
		local fstat r(F)
		local fprob 1-F(r(df_m), r(df_r),r(F))
		
file write TABLE "," (`fstat') "," (`fprob')  _n     
}
file close TABLE
restore


*** Descriptive in the manuscript***
tab comments_will_manual if wave==1
tab comments_will_manual if wave==2

tab policy_eva comments_will_manual if wave==1
tab policy_eva comments_will_manual if wave==2


tab male if wave==1
tab male if wave==2

tab age if wave==1
tab age if wave==2

tab edu if wave==1
tab edu if wave==2

tab party if wave==1
tab party if wave==2














*****ttest: Policy Approval***

********************************
preserve
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
recode policy_eva 1=0 2=0.5 3=1

file open TABLE using "ttest_policy_eva.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest policy_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore
*************Wave 1** Table 2
********************************
preserve
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
recode policy_eva 1=0 2=0.5 3=1

drop if wave==2
file open TABLE using "ttest_policy_eva1.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest policy_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore
*****wave2***** Table 3
****
preserve
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
recode policy_eva 1=0 2=0.5 3=1

drop if wave==1
file open TABLE using "ttest_policy_eva2.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest policy_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore





***************************************************t
***    t-test: Commenting Behavior ***/ 



preserve 
file open TABLE using "ttest.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
foreach k of numlist 1/4{
ttest comments_will_manual if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE
restore

*******wave 1******Table 2
preserve
drop if wave==2
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest1.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest comments_will_manual if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore
*****wave2** Table 3
preserve
drop if wave==1
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest2.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest comments_will_manual if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore



********Comments Behavior Recoded (0,0.5,1) Table D.4

*******wave 1******
preserve
drop if wave==2
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest1_recoded.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest comments_will_manual2 if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore
*****wave2**
preserve
drop if wave==1
recode e_group 1=5 2=1 3=2 4=3 5=4
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest2_recoded.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest comments_will_manual2 if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore




*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


****group baseline regression




*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

eststo clear

label define egroup 1 "Baseline" 2 "Censor" 3 "Info" 4 "Ideo" 5 "Both", modify
					
					
label values e_group egroup					
 


preserve
recode wave 1=0 2=1
eststo: logit comments_will_manual i.e_group  $control wave, robust 

margins, dydx(e_group) atmeans
marginsplot, horiz title("",size(medium)) l(90) /*
*/ ytitle ("", color(black) size(medium)) /*
*/xtitle ("", color(black) size(small)) /*
*/ yscale(rev) /* 
*/ylab(1 "Censor" 2 "Info" 3 "Ideo" 4 "Both" ) /*
*/graphregion ( lcolor(black) color(white) )  /*
*/ xline(0, lpattern(dash) lcolor(gs10)) /*
*/plotregion( fcolor(white))    plotopts(mc(black) lc(black) msiz(vsmall) c(i))

graph export reg_g_comment.pdf, replace  // Table D.1
restore


preserve
recode policy_eva 1=0 2=0.5 3=1
recode wave 1=0 2=1
eststo: reg policy_eva i.e_group  $control wave, robust

margins, dydx(e_group) atmeans
marginsplot, horiz title("",size(medium)) l(90) /*
*/ ytitle ("", color(black) size(medium)) /*
*/xtitle ("", color(black) size(small)) /*
*/ yscale(rev) /* 
*/ylab(1 "Censor" 2 "Info" 3 "Ideo" 4 "Both" ) /*
*/graphregion ( lcolor(black) color(white) )  /*
*/ xline(0, lpattern(dash) lcolor(gs10)) /*
*/plotregion( fcolor(white))    plotopts(mc(black) lc(black) msiz(vsmall) c(i))

graph export reg_g_policy_eva.pdf, replace // Table D.2
restore

preserve
recode wave 1=0 2=1
eststo: ologit policy_eva i.e_group  $control wave, robust



restore

**************************************
preserve
recode policy_eva 1=0 2=0.5 3=1
drop if policy_eva==0
replace gap_eva=(gap_eva-1)*(-1)
recode wave 1=0 2=1
eststo: logit gap_eva i.e_group  $control wave, robust 

margins, dydx(e_group) atmeans
marginsplot, horiz title("",size(medium)) l(90) /*
*/ ytitle ("", color(black) size(medium)) /*
*/xtitle ("", color(black) size(small)) /*
*/ yscale(rev) /* 
*/ylab(1 "Censor" 2 "Info" 3 "Ideo" 4 "Both" ) /*
*/graphregion ( lcolor(black) color(white) )  /*
*/ xline(0, lpattern(dash) lcolor(gs10)) /*
*/plotregion( fcolor(white))    plotopts(mc(black) lc(black) msiz(vsmall) c(i))

graph export reg_g_gap_policy.pdf, replace // Table D.3

restore 


esttab using main_group.tex, b(%9.3fc) label replace se nogaps ///
stats(N r2 r2_p ll chi2, fmt(%9.3fc) labels("Observations" "R$^2$" "Pseudo R$^2$" "Log Likelihood" "$\chi^2$")) ///
star(* 0.10 ** 0.05 *** 0.01) eqlabels("") title(Regression Results ) ///
nonotes compress ///
mtitles("Comments(Logit)" "Policy Approval(OLS)" "Policy Approval(Ologit)" ///
		"A.S.(Policy, Logit)") /// 
		drop(1.e_group) ///
order ()


eststo clear







**************************************************
******************Active Supporter********************
**************************************************


**Balance Check**

preserve 
drop if policy_eva==1


*** Balance Table*****
eststo Control: estpost summarize  $control if e_group==1
eststo Censor: estpost summarize  $control if e_group==2

eststo Info: estpost summarize $control if e_group==3

eststo Ideo: estpost summarize  $control if e_group==4
eststo Both: estpost summarize $control if e_group==5

***table c3
esttab   using summary_prop_support_eva2.csv, ///
		label replace cell("mean(fmt(2)) sd(fmt(2))")  b(2) ///
		mgroups("Control" "Censor" "Info" "Ideo" "Both" , pattern(1 1 1 1 1))
		
eststo clear 

file open TABLE using "balance_prop_support_eva2.csv", write replace

foreach val of varlist $control {

		oneway `val' e_group 
		local fstat r(F)
		local fprob 1-F(r(df_m), r(df_r),r(F))
		
file write TABLE "," (`fstat') "," (`fprob')  _n     
}
file close TABLE
restore
***wave1
preserve 
drop if policy_eva==1
drop if wave==2

*** Balance Table*****
eststo Control: estpost summarize  $control if e_group==1
eststo Censor: estpost summarize  $control if e_group==2

eststo Info: estpost summarize $control if e_group==3

eststo Ideo: estpost summarize  $control if e_group==4
eststo Both: estpost summarize $control if e_group==5

***table c4
esttab   using summary_prop_support_eva2_w1.csv, ///
		label replace cell("mean(fmt(2)) sd(fmt(2))")  b(2) ///
		mgroups("Control" "Censor" "Info" "Ideo" "Both" , pattern(1 1 1 1 1))
		
eststo clear

file open TABLE using "balance_prop_support_eva2_w1.csv", write replace

foreach val of varlist $control {

		oneway `val' e_group 
		local fstat r(F)
		local fprob 1-F(r(df_m), r(df_r),r(F))
		
file write TABLE "," (`fstat') "," (`fprob')  _n     
}
file close TABLE
restore

***wave2
preserve 
drop if policy_eva==1
drop if wave==1

*** Balance Table*****
eststo Control: estpost summarize  $control if e_group==1
eststo Censor: estpost summarize  $control if e_group==2

eststo Economy: estpost summarize $control if e_group==3

eststo Nationalism: estpost summarize  $control if e_group==4
eststo Both: estpost summarize $control if e_group==5


esttab   using summary_prop_support_eva2_w2.csv, ///
		label replace cell("mean(fmt(2)) sd(fmt(2))")  b(2) ///
		mgroups("Control" "Censor" "Info" "Ideo" "Both" , pattern(1 1 1 1 1))
		
eststo clear

file open TABLE using "balance_prop_support_eva2_w2.csv", write replace

foreach val of varlist $control {

		oneway `val' e_group 
		local fstat r(F)
		local fprob 1-F(r(df_m), r(df_r),r(F))
		
file write TABLE "," (`fstat') "," (`fprob')  _n     
}
file close TABLE
restore





************
***/     t-test baseline: Active Supporter***/ Table2 and Table 3

preserve
drop if policy_eva==1

recode e_group 1=5 2=1 3=2 4=3 5=4
recode gap_eva 1=0 0=1
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest_gap_eva.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest gap_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore



*******Wave 1***

preserve
drop if policy_eva==1
drop if wave==2

recode e_group 1=5 2=1 3=2 4=3 5=4
recode gap_eva 1=0 0=1
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest_gap_eva1.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest gap_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore


*****wave 2****

preserve
drop if policy_eva==1
drop if wave==1
recode e_group 1=5 2=1 3=2 4=3 5=4
recode gap_eva 1=0 0=1
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest_gap_eva2.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest gap_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore



*******************************************
***********ACtive Opponents***********************
*******************************************

************
***/t-test***/ ** Figure D.6

preserve
drop if policy_eva>1

recode e_group 1=5 2=1 3=2 4=3 5=4
recode gap_eva 2=1
la de group2 1 "Censor" 2 "Informational" 3 "Ideological" 4 "Both" 5 "Control", modify
la var e_group group2
file open TABLE using "ttest_gap_eva_opp.txt", write replace
file write TABLE "dv, mean, se, ll95, ul95, ll90, ul90, N1, N2" _n

foreach k of numlist 1/4 {
ttest gap_eva if e_group==`k' | e_group==5, by(e_group)
scalar miu=r(mu_1)-r(mu_2)
scalar se=r(se)
scalar ll95=miu-1.96*se
scalar ul95=miu+1.96*se
scalar ll90=miu-1.64*se
scalar ul90=miu+1.64*se
scalar n1=r(N_1)
scalar n2=r(N_2)

file write TABLE "`k'" "," (miu) "," (se) "," (ll95) "," (ul95) "," (ll90) "," (ul90) "," (n1) "," (n2) _n

}
file close TABLE

restore


********If information treatment works differently in education level
**** Figure D4
preserve
gen t_group=0 if e_group==1
replace t_group=1 if e_group==3
recode wave 1=0 2=1
drop if policy_eva==1
reg gap_eva c.edu##i.t_group wave $control, robust
esttab using info_edu.csv, b(%9.3fc) label replace se ///
stats(N r2, fmt(%9.3fc) labels("Observations" "R2")) ///
star(* 0.10 ** 0.05 *** 0.01) eqlabels("") title(Regression Results ) ///
nonotes compress ///
mtitles("Education") 
		
quietly reg comments_will_manual c.edu##i.t_group wave $control, robust

margins, dydx(t_group) at(edu=(0 1))
marginsplot,title("", size(small)) nolab level(95) /*
*/xtitle ("Education", color(black) size(small)) /*
*/xla(,labsize(vsmall)) /*
*/graphregion ( lcolor(black) color(white) ) /*
*/yline(0, lc(black) lp(dash)) ytitle("Marginal Effect on Comments") /*
*/plotregion( fcolor(white)) ylab (, nogrid) plotopts(mc(black) lc(black)) /*
*/note("95% CI; For Education Level, 1 means Bacholar Degree or above", size(vsmall)) 

gr save margin_benefit_edu, replace
gr export margin_benefit_edu.png, replace
gr export margin_benefit_edu.eps, replace


restore


********If information treatment works differently for personal benefits
*** Figure D5
preserve

gen t_group=0 if e_group==1
replace t_group=1 if e_group==3 
recode wave 1=0 2=1
drop if policy_eva==1

reg gap_eva c.obor_benefit##i.t_group wave $control, robust
esttab using infor_benefit.csv, b(%9.3fc) label replace se ///
stats(N r2, fmt(%9.3fc) labels("Observations" "R2")) ///
star(* 0.10 ** 0.05 *** 0.01) eqlabels("") title(Regression Results ) ///
nonotes compress ///
mtitles("Personal Benefit") 

			
quietly reg comments_will_manual c.obor_benefit##i.t_group wave $control, robust
margins, dydx(t_group) at(obor_benefit=(1(1)4))
marginsplot,title("", size(small)) level(95) /*
*/xtitle ("BRI perception on personal gain", color(black) size(small)) /*
*/xla(,labsize(vsmall)) /*
*/graphregion ( lcolor(black) color(white) ) /*
*/yline(0, lc(black) lp(dash)) ytitle("Marginal Effect on Comments") /*
*/plotregion( fcolor(white)) ylab (, nogrid) plotopts(mc(black) lc(black)) /*
*/note("95% CI; For BRI perception, the larger the value, the more personal benefits perceived ", size(vsmall)) 

gr save margin_benefit_information, replace
gr export margin_benefit_information.png, replace
gr export margin_benefit_information.eps, replace


restore





***Whether critical supporter is different across groups**



gen comments_will_manual3=comments_will_manual2
recode comments_will_manual3 0.5=1

oneway comments_will_manual3 e_group





***********commment length***** ** Table D5; Figree D7, D8

gen comment_cal="" 
replace comment_cal=comment if wave==1


replace comment_cal=treat2_nocost if wave==2
replace comment_cal=treat2_costly if wave==2 & comment_cal==""

replace comment_cal=subinstr(comment_cal, "不想评论", " ", 1)
replace comment_cal=subinstr(comment_cal, "不想反驳", " ", 1)
replace comment_cal=subinstr(comment_cal, "不知说啥", " ", 1)
replace comment_cal=subinstr(comment_cal, "不行评论", " ", 1)
replace comment_cal=subinstr(comment_cal, "你想评论", " ", 1)
replace comment_cal=subinstr(comment_cal, "不想评价", " ", 1)
replace comment_cal=subinstr(comment_cal, "不作评论", " ", 1)
replace comment_cal=subinstr(comment_cal, "不想写评论", " ", 1)
replace comment_cal=subinstr(comment_cal, "还没想好", " ", 1)

gen char_count=length(comment_cal)

bysort wave comments_will_manual: sum char_count

ciplot char_count , by(e_group)  ytitle("") xtitle("") ///
					title(Average Characters of Comments)
					
gr export char_count.pdf, replace

ciplot char_count if comments_will_manual==1, by(e_group)  ytitle("") xtitle("") ///
					title(Average Comments(Refutation Only))
					
gr export char_count_refute.pdf, replace

ciplot char_count if comments_will_manual==0, by(e_group)  ytitle("") xtitle("") ///
					title(Average Comments(No Refutation ))
					
gr export char_count_no_refute.pdf, replace

ciplot char_count if char_count>5, by(e_group)  ytitle("") xtitle("") ///
					title(Average Comments(> 5 Characters))
					
gr export char_count_larger5.pdf, replace


preserve
keep comment_cal comments_will_manual e_group wave

save "comments_sentiment.dta", replace
restore




******************************** sentiment ***********************
*** Figure D9


ciplot emotion, by(e_group) ///
				xtitle("") ytitle("") ///
				title("Sentiment of comments")

gr export sentiment_egroup.pdf, replace
gr export sentiment_egroup.tif, replace






***multiple hypothesis testing*** Table D6

gen t_censor=.
replace t_censor=0 if e_group==1
replace t_censor=1 if e_group==2

gen t_info=.
replace t_info=0 if e_group==1
replace t_info=1 if e_group==3

gen t_ideo=.
replace t_ideo=0 if e_group==1
replace t_ideo=1 if e_group==4

gen t_both=.
replace t_both=0 if e_group==1
replace t_both=1 if e_group==5

gen comments_test=comments_will_manual


rwolf policy_eva comments_test gap_eva, indepvar(t_censor) controls($control wave) reps(100) seed(20) method(regress) 
rwolf policy_eva comments_test gap_eva, indepvar(t_info) controls($control wave) reps(100) seed(20) method(regress) 
rwolf policy_eva comments_test gap_eva, indepvar(t_ideo) controls($control wave) reps(100) seed(50) method(regress) 
rwolf policy_eva comments_test gap_eva, indepvar(t_both) controls($control wave) reps(100) seed(20) method(regress) 



log close
******************************************************************
****************END***********************************************
******************************************************************
******************************************************************
******************************************************************
******************************************************************


























